const b1 = Buffer.alloc(10)
console.log(b1) // <Buffer 00 00 00 00 00 00 00 00 00 00>

const b2 = Buffer.allocUnsafe(10)
console.log(b2) // <Buffer 00 00 00 00 00 00 00 00 a0 94> 随机

const b3 = Buffer.from('1', 'utf-8')
const b4 = Buffer.from('哈', 'utf-8')
console.log(b3) // <Buffer 31>
console.log(b4) // <Buffer e5 93 88>

const b5 = Buffer.from([1, 2, 3])
console.log(b5) // <Buffer 01 02 03>

const b6 = Buffer.from([1, 2, '哈'])
console.log(b5) // <Buffer 01 02 03>

const b7 = Buffer.from('哈', 'utf-8')
console.log(b7.toString()) // 哈

const b8 = Buffer.from([0xe5, 0x93, 0x88])
console.log(b8.toString()) // 哈
